var pic = document.querySelector('.banner_img');
var dian = document.querySelectorAll('.dian a');
var timer;
var q = 0;
for(var i = 0;i < dian.length;i++){
	dian[i].index = i;
	dian[i].onclick=function(){
		var j = this.index;
		for(var a = 0;a < dian.length;a++){
			dian[a].style.background='#fff';
		}
		dian[j].style.background='#ff5000';
		pic.style.left='-'+j*520+'px'
		q = j;
	}
}

function play() {
	timer = setInterval(function() {
		dian[q].style.background = '#FFf';
		q++;
		if(q > 2) {
			q = 0;
		}
		pic.style.left ='-'+q*520+'px';
		dian[q].style.background = '#FF5000';
	}, 3000)
}
play();

pic.onmouseover = function() {
	clearInterval(timer);
}
pic.onmouseout = function() {
	play();
}

var li = document.querySelectorAll('.notice-hd li');
var block = document.querySelectorAll('.first');

for(var o = 0;o < li.length;o++){
	li[o].index = o;
	li[o].onmouseover=function(){
		var l = this.index;
		for(var p = 0;p < li.length;p++){
			li[p].style.borderBottom='none'
			block[p].style.display='none';
		}
		li[l].style.borderBottom='2px solid #F40'
		block[l].style.display='block';
	}
}


var bs = document.querySelectorAll('.ks-switchable-nav ul li');
var inp = document.querySelector('.search-panel-fields input');
var pai = document.querySelector('.search-hots-fline')

for(var l = 0;l < bs.length;l++){
	bs[l].index=l;
	bs[l].onclick=function(){
		var num = this.index;
		for(var b = 0;b < bs.length;b++){
			bs[b].style.color='#f40';
			bs[b].style.background='none';
		}
		if(bs[num].innerHTML!='宝贝'){
			inp.placeholder=' ';
		}else{
			inp.placeholder='初秋长袖上衣女';
		}
		if(bs[num].innerHTML=='天猫'){
			pai.style.display='none';
		}else{
			pai.style.display='block';
		}
		bs[num].style.color='#fff';
		bs[num].style.background='linear-gradient(90deg, #ff9000, #ff5000)';
	}
}